home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / tex-k / tex-k-archive.past / tex-k-archive.gz / tex-k-archive / 000408_interran@uluru.Stanford.EDU_Wed Mar 16 18:45:02 1994.msg < prev    next >
Internet Message Format  |  1994-10-11  |  4KB

  1. Received: from uluru.Stanford.EDU by cs.umb.edu with SMTP id AA28071
  2.   (5.65c/IDA-1.4.4 for <tex-k@cs.umb.edu>); Thu, 17 Mar 1994 05:42:16 -0500
  3. Received: by uluru.Stanford.EDU (4.1/inc-1.0)
  4.     id AA00630; Thu, 17 Mar 94 02:45:02 PST
  5. Date: Thu, 17 Mar 94 02:45:02 PST
  6. From: interran@uluru.Stanford.EDU (John Interrante)
  7. Message-Id: <9403171045.AA00630@uluru.Stanford.EDU>
  8. To: tex-k@cs.umb.edu
  9. In-Reply-To: <199403161042.AA26887@terminus.cs.umb.edu> (kb@cs.umb.edu)
  10. Subject: Re:  xdvik-1.7: when does it use MakeTeXPK?
  11.  
  12. I figured out why xdvi isn't calling MakeTeXPK.  The file I was
  13. running xdvi on, PSNFSS 2.4.1's testps.tex, used so many different
  14. fonts that xdvi had run completely out of open files by the time it
  15. attempted to call popen("MakeTeXPK rptmr 432 300 magstep\\(2.0\\) cx",
  16. "r") at kpathsea/tex-make.c:87.  The popen() couldn't open a new file
  17. descriptor so it returned NULL and MakeTeXPK never got called.  My
  18. first idea was to check errno's value in the debugger to see if the
  19. code could recover by closing a couple of files and calling popen
  20. again, but it turned out that errno wasn't set to anything, much less
  21. EMFILE or ENFILE---it was zero even after popen returned NULL.
  22. Besides, I also realized that the kpathsea code doesn't know what the
  23. open files are---only the xdvi code knows what they are.
  24.  
  25. With experimentation by setting a conditional breakpoint in gdb and
  26. giving it commands to execute, I found out that xdvi would call
  27. MakeTeXPK if font_open() checked the number of file descriptors
  28. remaining and closed two open files before calling
  29. kpse_find_glyph_format().  I then made the corresponding change to the
  30. source code (it was necessary to change two other files as well so
  31. that font-open.c could call close_a_file() which used to be a static
  32. function in util.c) and experimented with xdvi for a while.  It turns
  33. out that the change still doesn't work perfectly; every once in a
  34. while xdvi'll still fail to realize that it's run out of file
  35. descriptors and forget to close two of them before calling MakeTeXPK.
  36. There's something not quite perfect yet about the book-keeping xdvi
  37. does to make n_files_left reflect the number of file descriptors left.
  38. If I rerun xdvi, it will succeed in calling MakeTeXPK the next time so
  39. I can just keep rerunning xdvi until it builds all of the fonts it
  40. needs.  That's good enough for me, so I'll post the fix and let
  41. somebody else improve it if they want to.
  42.  
  43.         John
  44.  
  45. *** xdvik/font-open.c.save    Thu Feb 24 08:52:17 1994
  46. --- xdvik/font-open.c    Wed Mar 16 17:36:41 1994
  47. ***************
  48. *** 30,35 ****
  49. --- 30,42 ----
  50.     else
  51.       {
  52.         kpse_font_file_type file_ret;
  53. +       if (use_maketexpk && n_files_left < 2)
  54. +     {
  55. +       /* We need two open files for popen if MakeTeXPK is to be
  56. +          called successfully.  */
  57. +       close_a_file();
  58. +       close_a_file();
  59. +     }
  60.         name = kpse_find_glyph_format (font, (unsigned) (dpi + .5),
  61.                                        kpse_any_glyph_format, &file_ret);
  62.         if (name)
  63. *** xdvik/util.c.save    Fri Jan 21 04:45:05 1994
  64. --- xdvik/util.c    Wed Mar 16 17:41:22 1994
  65. ***************
  66. *** 117,123 ****
  67.    *    Close the pixel file for the least recently used font.
  68.    */
  69.   
  70. ! static    void
  71.   close_a_file()
  72.   {
  73.       register struct font *fontp;
  74. --- 117,123 ----
  75.    *    Close the pixel file for the least recently used font.
  76.    */
  77.   
  78. ! void
  79.   close_a_file()
  80.   {
  81.       register struct font *fontp;
  82. *** xdvik/xdvi.h.save    Fri Feb 25 05:51:50 1994
  83. --- xdvik/xdvi.h    Wed Mar 16 17:41:03 1994
  84. ***************
  85. *** 429,434 ****
  86. --- 429,435 ----
  87.   #endif
  88.   extern    char    *xmalloc(unsigned, _Xconst char *);
  89.   extern    void    alloc_bitmap(struct bitmap *);
  90. + extern    void    close_a_file(void);
  91.   extern    FILE    *xfopen(_Xconst char *);
  92.   extern    unsigned long    num(FILE *, int);
  93.   extern    long    snum(FILE *, int);
  94. ***************
  95. *** 475,480 ****
  96. --- 476,482 ----
  97.   extern    NORETURN void    oops();
  98.   extern    char    *xmalloc();
  99.   extern    void    alloc_bitmap();
  100. + extern    void    close_a_file();
  101.   extern    FILE    *xfopen();
  102.   extern    unsigned long    num();
  103.   extern    long    snum();